﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int a = 1;int b = 1;
                char s = ' ';
                bool flag = true;
                while (flag)
                {
                    try
                    {
                        Write("输入第一个数a：");
                        a = Int32.Parse(ReadLine());
                    }
                    catch (Exception e)
                    {
                        WriteLine("请输入数字！！！");
                        continue;
                    }
                    try
                    { 
                        Write("输入第二个数b：");
                        b = Int32.Parse(ReadLine());
                        Write("输入操作符：");
                        s = Char.Parse(ReadLine());
                    }
                    catch (Exception e){
                        WriteLine("请输入数字！！！");
                        continue;
                    }
                    flag = false;
                }
                switch (s)
                {
                    case '+':WriteLine($"a+b={a+b}"); break;
                    case '-': WriteLine($"a-b={a - b}"); break;
                    case '*': WriteLine($"a*b={a * b}"); break;
                    case '/':if (b == 0)
                        {
                            WriteLine("除数不能为零，重新输入被除数");
                            b = Int32.Parse(ReadLine());
                        }
                        WriteLine($"a/b={a / b}"); break;
                    default:WriteLine("请输入正确的操作符！！！"); break;
                }
                WriteLine();

            }
           
        }
    }
}
